Consider the following x86 assembly language code segment, with line
numbers added for reference:
01 movl $0, %eax
02 movl $0, %ebx
03 loop:
04 movl %eax, %ecx
05 andl $1, %ecx
06 cmpl $1, %ecx
07 je over
08 incl %ebx
09 over:
10 incl %eax
11 cmpl $9999, %eax
12 jle loop
- (7 points) What will be the value of the %eax
register when the loop described by this code segment is finished?
- For each of the following branch predictors, what will be the
misprediction rate for the branch on line 7? Your answer should
be accurate to within 1% of the correct answer.
- (7 points) A Smith predictor with 128 1-bit entries
- (7 points) A Smith predictor with 128 2-bit entries
- (7 points) A two-level adaptive branch predictor with
a history length of 7 and 128 2-bit entries.